<template>
    <div>
        <h1>医生的个人简介详细说明</h1>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td>医生名称</td>
                    <td>{{ qureyInfo.doctorName }}</td>
                </tr>
                <tr>
                    <td>医生照片</td>
                    <td>

                        <img :src="qureyInfo.photo" alt="" width="60" height="60" v-if="qureyInfo.photo">
                    </td>
                </tr>
                <tr>
                    <td>科室名称</td>
                    <td>{{ qureyInfo.departmentName }}</td>
                </tr>
                <tr>
                    <td>职称</td>
                    <td>{{ qureyInfo.title }}</td>
                </tr>
                <tr>
                    <td>学历</td>
                    <td>{{ qureyInfo.eeuBgr }}</td>
                </tr>
                <tr>
                    <td>第一执业医院</td>
                    <td>{{ qureyInfo.hospital }}</td>
                </tr>
                <tr>
                    <td>是否开通账号</td>
                    <td>
                        {{ qureyInfo.state ? "开通" : "未开通" }}
                    </td>
                </tr>
                <tr>
                    <td>类型</td>
                    <td>{{ qureyInfo.types }}</td>
                </tr>

            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref, reactive, onMounted } from 'vue';
import moment from 'moment';
import { useRoute, useRouter } from 'vue-router';
const route = useRoute();
const router = useRouter();

onMounted(() => {
    getkelist();
    getDoctorItem();
})

let kelist: any = ref({});

let qureyInfo: any = reactive({
    "doctorName": "",
    "photo": "",
    "departmentName": "",
    "title": "",
    "eeuBgr": "",
    "hospital": "",
    "state": '',
    "types": "",
})
const getkelist = () => {
    axios({
        url: '/api/Ward/GetDepartment',
        method: 'get',
    })
        .then(res => {
            kelist.value = res.data;
        })
        .catch(err => {

        })
}

const img = (e: any) => {
    let obj = e.target.files[0];
    let f = new FormData();
    f.append('file', obj);
    axios({
        url: '/api/Imgs/Img',
        method: 'post',
        data: f,
    })
        .then(res => {
            if (res.data == "不是图片") {
                alert("你上传的不是图片");
                return;
            }
            if (res.data == "大于2M") {
                alert("你上传的图片大于2M");
                return;
            }
            else {
                qureyInfo.photo = res.data;
                return;
            }

        })
        .catch(err => {

        })
}
const Ok = () => {
    if (qureyInfo.doctorName == "") {
        alert("医生名称不能为空");
        return;
    }
    axios({
        url: '/api/Ward/DoctorAdd',
        method: 'post',
        data: qureyInfo,
    })
        .then(res => {
            if (res.data > 0) {
                alert("添加成功");
                router.push('/doctorList');
                return;
            }
            else {
                alert("添加失败");
                return;
            }
        })
}
const getDoctorItem = () => {
    axios({
        url: '/api/Ward/GetDoctorinformationItem',
        method: 'get',
        params: { id: route.query.id }
    })
        .then(res => {
            Object.assign(qureyInfo, res.data);
        })
        .catch(err => {

        })
}
</script>

<style scoped></style>